class LivehousesController < ApplicationController
  before_filter :login_required , :except => [:index, :show]
  # GET /livehouses
  # GET /livehouses.xml
  def index
    @livehouses = Livehouse.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @livehouses }
    end
  end

  # GET /livehouses/1
  # GET /livehouses/1.xml
  def show
    @livehouse = Livehouse.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @livehouse }
    end
  end

  # GET /livehouses/new
  # GET /livehouses/new.xml
  def new
    @livehouse = Livehouse.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @livehouse }
    end
  end

  # GET /livehouses/1/edit
  def edit
    @livehouse = Livehouse.find(params[:id])
  end

  # POST /livehouses
  # POST /livehouses.xml
  def create
    @livehouse = Livehouse.new(params[:livehouse])

    respond_to do |format|
      if @livehouse.save
        flash[:notice] = 'Livehouse was successfully created.'
        format.html { redirect_to(@livehouse) }
        format.xml  { render :xml => @livehouse, :status => :created, :location => @livehouse }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @livehouse.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /livehouses/1
  # PUT /livehouses/1.xml
  def update
    @livehouse = Livehouse.find(params[:id])

    respond_to do |format|
      if @livehouse.update_attributes(params[:livehouse])
        flash[:notice] = 'Livehouse was successfully updated.'
        format.html { redirect_to(@livehouse) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @livehouse.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /livehouses/1
  # DELETE /livehouses/1.xml
  def destroy
    @livehouse = Livehouse.find(params[:id])
    @livehouse.destroy

    respond_to do |format|
      format.html { redirect_to(livehouses_url) }
      format.xml  { head :ok }
    end
  end
end
